3.1.12 \(\int \frac {\sec (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx\) [12]

3.1.12.1 Optimal result
3.1.12.2 Mathematica [A] (verified)
3.1.12.3 Rubi [A] (verified)
3.1.12.4 Maple [A] (verified)
3.1.12.5 Fricas [A] (verification not implemented)
3.1.12.6 Sympy [F]
3.1.12.7 Maxima [F(-2)]
3.1.12.8 Giac [A] (verification not implemented)
3.1.12.9 Mupad [B] (verification not implemented)

3.1.12.1 Optimal result

Integrand size = 17, antiderivative size = 128 \[ \int \frac {\sec (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\frac {\left (b^2-2 a c-2 c^2\right ) \text {arctanh}\left (\frac {b+2 c \sin (x)}{\sqrt {b^2-4 a c}}\right )}{(a-b+c) (a+b+c) \sqrt {b^2-4 a c}}-\frac {\log (1-\sin (x))}{2 (a+b+c)}+\frac {\log (1+\sin (x))}{2 (a-b+c)}-\frac {b \log \left (a+b \sin (x)+c \sin ^2(x)\right )}{2 (a-b+c) (a+b+c)} \]

output
-1/2*ln(1-sin(x))/(a+b+c)+1/2*ln(1+sin(x))/(a-b+c)-1/2*b*ln(a+b*sin(x)+c*s 
in(x)^2)/(a-b+c)/(a+b+c)+(-2*a*c+b^2-2*c^2)*arctanh((b+2*c*sin(x))/(-4*a*c 
+b^2)^(1/2))/(a-b+c)/(a+b+c)/(-4*a*c+b^2)^(1/2)
 
3.1.12.2 Mathematica [A] (verified)

Time = 0.24 (sec) , antiderivative size = 119, normalized size of antiderivative = 0.93 \[ \int \frac {\sec (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=-\frac {\left (-2 b^2+4 c (a+c)\right ) \text {arctanh}\left (\frac {b+2 c \sin (x)}{\sqrt {b^2-4 a c}}\right )+\sqrt {b^2-4 a c} \left ((a-b+c) \log (1-\sin (x))-(a+b+c) \log (1+\sin (x))+b \log \left (a+b \sin (x)+c \sin ^2(x)\right )\right )}{2 (a-b+c) (a+b+c) \sqrt {b^2-4 a c}} \]

input
Integrate[Sec[x]/(a + b*Sin[x] + c*Sin[x]^2),x]
 
output
-1/2*((-2*b^2 + 4*c*(a + c))*ArcTanh[(b + 2*c*Sin[x])/Sqrt[b^2 - 4*a*c]] + 
 Sqrt[b^2 - 4*a*c]*((a - b + c)*Log[1 - Sin[x]] - (a + b + c)*Log[1 + Sin[ 
x]] + b*Log[a + b*Sin[x] + c*Sin[x]^2]))/((a - b + c)*(a + b + c)*Sqrt[b^2 
 - 4*a*c])
 
3.1.12.3 Rubi [A] (verified)

Time = 0.40 (sec) , antiderivative size = 125, normalized size of antiderivative = 0.98, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.235, Rules used = {3042, 3739, 1301, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\sec (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {1}{\cos (x) \left (a+b \sin (x)+c \sin (x)^2\right )}dx\)

\(\Big \downarrow \) 3739

\(\displaystyle \int \frac {1}{\left (1-\sin ^2(x)\right ) \left (a+b \sin (x)+c \sin ^2(x)\right )}d\sin (x)\)

\(\Big \downarrow \) 1301

\(\displaystyle -\int \left (\frac {b^2+c \sin (x) b-c (a+c)}{(a-b+c) (a+b+c) \left (c \sin ^2(x)+b \sin (x)+a\right )}-\frac {1}{2 (a+b+c) (1-\sin (x))}-\frac {1}{2 (a-b+c) (\sin (x)+1)}\right )d\sin (x)\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {\left (b^2-2 c (a+c)\right ) \text {arctanh}\left (\frac {b+2 c \sin (x)}{\sqrt {b^2-4 a c}}\right )}{(a-b+c) (a+b+c) \sqrt {b^2-4 a c}}-\frac {b \log \left (a+b \sin (x)+c \sin ^2(x)\right )}{2 (a-b+c) (a+b+c)}-\frac {\log (1-\sin (x))}{2 (a+b+c)}+\frac {\log (\sin (x)+1)}{2 (a-b+c)}\)

input
Int[Sec[x]/(a + b*Sin[x] + c*Sin[x]^2),x]
 
output
((b^2 - 2*c*(a + c))*ArcTanh[(b + 2*c*Sin[x])/Sqrt[b^2 - 4*a*c]])/((a - b 
+ c)*(a + b + c)*Sqrt[b^2 - 4*a*c]) - Log[1 - Sin[x]]/(2*(a + b + c)) + Lo 
g[1 + Sin[x]]/(2*(a - b + c)) - (b*Log[a + b*Sin[x] + c*Sin[x]^2])/(2*(a - 
 b + c)*(a + b + c))
 

3.1.12.3.1 Defintions of rubi rules used

rule 1301
Int[((a_.) + (c_.)*(x_)^2)^(p_)*((d_.) + (e_.)*(x_) + (f_.)*(x_)^2)^(q_), x 
_Symbol] :> With[{r = Rt[(-a)*c, 2]}, Simp[1/c^p   Int[ExpandIntegrand[(-r 
+ c*x)^p*(r + c*x)^p*(d + e*x + f*x^2)^q, x], x], x] /; EqQ[p, -1] ||  !Fra 
ctionalPowerFactorQ[r]] /; FreeQ[{a, c, d, e, f}, x] && ILtQ[p, 0] && Integ 
erQ[q] && NiceSqrtQ[(-a)*c]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3739
Int[cos[(d_.) + (e_.)*(x_)]^(m_.)*((a_.) + (b_.)*((f_.)*sin[(d_.) + (e_.)*( 
x_)])^(n_.) + (c_.)*((f_.)*sin[(d_.) + (e_.)*(x_)])^(n2_.))^(p_.), x_Symbol 
] :> Module[{g = FreeFactors[Sin[d + e*x], x]}, Simp[g/e   Subst[Int[(1 - g 
^2*x^2)^((m - 1)/2)*(a + b*(f*g*x)^n + c*(f*g*x)^(2*n))^p, x], x, Sin[d + e 
*x]/g], x]] /; FreeQ[{a, b, c, d, e, f, n, p}, x] && EqQ[n2, 2*n] && Intege 
rQ[(m - 1)/2]
 
3.1.12.4 Maple [A] (verified)

Time = 0.86 (sec) , antiderivative size = 118, normalized size of antiderivative = 0.92

method result size
default \(\frac {\ln \left (1+\sin \left (x \right )\right )}{2 a -2 b +2 c}+\frac {-\frac {b \ln \left (a +b \sin \left (x \right )+c \left (\sin ^{2}\left (x \right )\right )\right )}{2}+\frac {2 \left (a c -\frac {1}{2} b^{2}+c^{2}\right ) \arctan \left (\frac {b +2 \sin \left (x \right ) c}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}}}{\left (a -b +c \right ) \left (a +b +c \right )}-\frac {\ln \left (\sin \left (x \right )-1\right )}{2 a +2 b +2 c}\) \(118\)
risch \(\text {Expression too large to display}\) \(1369\)

input
int(sec(x)/(a+b*sin(x)+c*sin(x)^2),x,method=_RETURNVERBOSE)
 
output
1/(2*a-2*b+2*c)*ln(1+sin(x))+1/(a-b+c)/(a+b+c)*(-1/2*b*ln(a+b*sin(x)+c*sin 
(x)^2)+2*(a*c-1/2*b^2+c^2)/(4*a*c-b^2)^(1/2)*arctan((b+2*sin(x)*c)/(4*a*c- 
b^2)^(1/2)))-1/(2*a+2*b+2*c)*ln(sin(x)-1)
 
3.1.12.5 Fricas [A] (verification not implemented)

Time = 0.79 (sec) , antiderivative size = 482, normalized size of antiderivative = 3.77 \[ \int \frac {\sec (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\left [-\frac {{\left (b^{2} - 2 \, a c - 2 \, c^{2}\right )} \sqrt {b^{2} - 4 \, a c} \log \left (-\frac {2 \, c^{2} \cos \left (x\right )^{2} - 2 \, b c \sin \left (x\right ) - b^{2} + 2 \, a c - 2 \, c^{2} + \sqrt {b^{2} - 4 \, a c} {\left (2 \, c \sin \left (x\right ) + b\right )}}{c \cos \left (x\right )^{2} - b \sin \left (x\right ) - a - c}\right ) + {\left (b^{3} - 4 \, a b c\right )} \log \left (-c \cos \left (x\right )^{2} + b \sin \left (x\right ) + a + c\right ) - {\left (a b^{2} + b^{3} - 4 \, a c^{2} - {\left (4 \, a^{2} + 4 \, a b - b^{2}\right )} c\right )} \log \left (\sin \left (x\right ) + 1\right ) + {\left (a b^{2} - b^{3} - 4 \, a c^{2} - {\left (4 \, a^{2} - 4 \, a b - b^{2}\right )} c\right )} \log \left (-\sin \left (x\right ) + 1\right )}{2 \, {\left (a^{2} b^{2} - b^{4} - 4 \, a c^{3} - {\left (8 \, a^{2} - b^{2}\right )} c^{2} - 2 \, {\left (2 \, a^{3} - 3 \, a b^{2}\right )} c\right )}}, \frac {2 \, {\left (b^{2} - 2 \, a c - 2 \, c^{2}\right )} \sqrt {-b^{2} + 4 \, a c} \arctan \left (-\frac {\sqrt {-b^{2} + 4 \, a c} {\left (2 \, c \sin \left (x\right ) + b\right )}}{b^{2} - 4 \, a c}\right ) - {\left (b^{3} - 4 \, a b c\right )} \log \left (-c \cos \left (x\right )^{2} + b \sin \left (x\right ) + a + c\right ) + {\left (a b^{2} + b^{3} - 4 \, a c^{2} - {\left (4 \, a^{2} + 4 \, a b - b^{2}\right )} c\right )} \log \left (\sin \left (x\right ) + 1\right ) - {\left (a b^{2} - b^{3} - 4 \, a c^{2} - {\left (4 \, a^{2} - 4 \, a b - b^{2}\right )} c\right )} \log \left (-\sin \left (x\right ) + 1\right )}{2 \, {\left (a^{2} b^{2} - b^{4} - 4 \, a c^{3} - {\left (8 \, a^{2} - b^{2}\right )} c^{2} - 2 \, {\left (2 \, a^{3} - 3 \, a b^{2}\right )} c\right )}}\right ] \]

input
integrate(sec(x)/(a+b*sin(x)+c*sin(x)^2),x, algorithm="fricas")
 
output
[-1/2*((b^2 - 2*a*c - 2*c^2)*sqrt(b^2 - 4*a*c)*log(-(2*c^2*cos(x)^2 - 2*b* 
c*sin(x) - b^2 + 2*a*c - 2*c^2 + sqrt(b^2 - 4*a*c)*(2*c*sin(x) + b))/(c*co 
s(x)^2 - b*sin(x) - a - c)) + (b^3 - 4*a*b*c)*log(-c*cos(x)^2 + b*sin(x) + 
 a + c) - (a*b^2 + b^3 - 4*a*c^2 - (4*a^2 + 4*a*b - b^2)*c)*log(sin(x) + 1 
) + (a*b^2 - b^3 - 4*a*c^2 - (4*a^2 - 4*a*b - b^2)*c)*log(-sin(x) + 1))/(a 
^2*b^2 - b^4 - 4*a*c^3 - (8*a^2 - b^2)*c^2 - 2*(2*a^3 - 3*a*b^2)*c), 1/2*( 
2*(b^2 - 2*a*c - 2*c^2)*sqrt(-b^2 + 4*a*c)*arctan(-sqrt(-b^2 + 4*a*c)*(2*c 
*sin(x) + b)/(b^2 - 4*a*c)) - (b^3 - 4*a*b*c)*log(-c*cos(x)^2 + b*sin(x) + 
 a + c) + (a*b^2 + b^3 - 4*a*c^2 - (4*a^2 + 4*a*b - b^2)*c)*log(sin(x) + 1 
) - (a*b^2 - b^3 - 4*a*c^2 - (4*a^2 - 4*a*b - b^2)*c)*log(-sin(x) + 1))/(a 
^2*b^2 - b^4 - 4*a*c^3 - (8*a^2 - b^2)*c^2 - 2*(2*a^3 - 3*a*b^2)*c)]
 
3.1.12.6 Sympy [F]

\[ \int \frac {\sec (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\int \frac {\sec {\left (x \right )}}{a + b \sin {\left (x \right )} + c \sin ^{2}{\left (x \right )}}\, dx \]

input
integrate(sec(x)/(a+b*sin(x)+c*sin(x)**2),x)
 
output
Integral(sec(x)/(a + b*sin(x) + c*sin(x)**2), x)
 
3.1.12.7 Maxima [F(-2)]

Exception generated. \[ \int \frac {\sec (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\text {Exception raised: ValueError} \]

input
integrate(sec(x)/(a+b*sin(x)+c*sin(x)^2),x, algorithm="maxima")
 
output
Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*a*c-b^2>0)', see `assume?` for 
 more deta
 
3.1.12.8 Giac [A] (verification not implemented)

Time = 0.32 (sec) , antiderivative size = 131, normalized size of antiderivative = 1.02 \[ \int \frac {\sec (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=-\frac {b \log \left (c \sin \left (x\right )^{2} + b \sin \left (x\right ) + a\right )}{2 \, {\left (a^{2} - b^{2} + 2 \, a c + c^{2}\right )}} - \frac {{\left (b^{2} - 2 \, a c - 2 \, c^{2}\right )} \arctan \left (\frac {2 \, c \sin \left (x\right ) + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{{\left (a^{2} - b^{2} + 2 \, a c + c^{2}\right )} \sqrt {-b^{2} + 4 \, a c}} + \frac {\log \left (\sin \left (x\right ) + 1\right )}{2 \, {\left (a - b + c\right )}} - \frac {\log \left (-\sin \left (x\right ) + 1\right )}{2 \, {\left (a + b + c\right )}} \]

input
integrate(sec(x)/(a+b*sin(x)+c*sin(x)^2),x, algorithm="giac")
 
output
-1/2*b*log(c*sin(x)^2 + b*sin(x) + a)/(a^2 - b^2 + 2*a*c + c^2) - (b^2 - 2 
*a*c - 2*c^2)*arctan((2*c*sin(x) + b)/sqrt(-b^2 + 4*a*c))/((a^2 - b^2 + 2* 
a*c + c^2)*sqrt(-b^2 + 4*a*c)) + 1/2*log(sin(x) + 1)/(a - b + c) - 1/2*log 
(-sin(x) + 1)/(a + b + c)
 
3.1.12.9 Mupad [B] (verification not implemented)

Time = 18.91 (sec) , antiderivative size = 1001, normalized size of antiderivative = 7.82 \[ \int \frac {\sec (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\frac {\ln \left (\sin \left (x\right )+1\right )}{2\,\left (a-b+c\right )}-\frac {\ln \left (\sin \left (x\right )-1\right )}{2\,\left (a+b+c\right )}+\frac {\ln \left (4\,c^3\,\sin \left (x\right )+b\,c^2+\frac {\left (a\,\left (4\,b\,c-2\,c\,\sqrt {b^2-4\,a\,c}\right )-b^3+b^2\,\sqrt {b^2-4\,a\,c}-2\,c^2\,\sqrt {b^2-4\,a\,c}\right )\,\left (8\,a\,c^3+\sin \left (x\right )\,\left (-3\,b^3\,c+12\,b\,c^3+12\,a\,b\,c^2\right )+4\,c^4+4\,a^2\,c^2+3\,b^2\,c^2-\frac {\left (a\,\left (4\,b\,c-2\,c\,\sqrt {b^2-4\,a\,c}\right )-b^3+b^2\,\sqrt {b^2-4\,a\,c}-2\,c^2\,\sqrt {b^2-4\,a\,c}\right )\,\left (\sin \left (x\right )\,\left (-8\,a^3\,c^2+2\,a^2\,b^2\,c-8\,a^2\,c^3-20\,a\,b^2\,c^2+8\,a\,c^4+6\,b^4\,c-6\,b^2\,c^3+8\,c^5\right )+4\,b\,c^4+4\,b^3\,c^2-28\,a^2\,b\,c^2-24\,a\,b\,c^3+8\,a\,b^3\,c\right )}{b^2\,\left (2\,a^2+12\,a\,c-2\,b^2+2\,c^2\right )-4\,a\,c\,\left (2\,a^2+4\,a\,c+2\,c^2\right )}-a\,b^2\,c\right )}{b^2\,\left (2\,a^2+12\,a\,c-2\,b^2+2\,c^2\right )-4\,a\,c\,\left (2\,a^2+4\,a\,c+2\,c^2\right )}\right )\,\left (a\,\left (4\,b\,c-2\,c\,\sqrt {b^2-4\,a\,c}\right )-b^3+b^2\,\sqrt {b^2-4\,a\,c}-2\,c^2\,\sqrt {b^2-4\,a\,c}\right )}{b^2\,\left (2\,a^2+12\,a\,c-2\,b^2+2\,c^2\right )-4\,a\,c\,\left (2\,a^2+4\,a\,c+2\,c^2\right )}+\frac {\ln \left (4\,c^3\,\sin \left (x\right )+b\,c^2+\frac {\left (a\,\left (4\,b\,c+2\,c\,\sqrt {b^2-4\,a\,c}\right )-b^3-b^2\,\sqrt {b^2-4\,a\,c}+2\,c^2\,\sqrt {b^2-4\,a\,c}\right )\,\left (8\,a\,c^3+\sin \left (x\right )\,\left (-3\,b^3\,c+12\,b\,c^3+12\,a\,b\,c^2\right )+4\,c^4+4\,a^2\,c^2+3\,b^2\,c^2-\frac {\left (a\,\left (4\,b\,c+2\,c\,\sqrt {b^2-4\,a\,c}\right )-b^3-b^2\,\sqrt {b^2-4\,a\,c}+2\,c^2\,\sqrt {b^2-4\,a\,c}\right )\,\left (\sin \left (x\right )\,\left (-8\,a^3\,c^2+2\,a^2\,b^2\,c-8\,a^2\,c^3-20\,a\,b^2\,c^2+8\,a\,c^4+6\,b^4\,c-6\,b^2\,c^3+8\,c^5\right )+4\,b\,c^4+4\,b^3\,c^2-28\,a^2\,b\,c^2-24\,a\,b\,c^3+8\,a\,b^3\,c\right )}{b^2\,\left (2\,a^2+12\,a\,c-2\,b^2+2\,c^2\right )-4\,a\,c\,\left (2\,a^2+4\,a\,c+2\,c^2\right )}-a\,b^2\,c\right )}{b^2\,\left (2\,a^2+12\,a\,c-2\,b^2+2\,c^2\right )-4\,a\,c\,\left (2\,a^2+4\,a\,c+2\,c^2\right )}\right )\,\left (a\,\left (4\,b\,c+2\,c\,\sqrt {b^2-4\,a\,c}\right )-b^3-b^2\,\sqrt {b^2-4\,a\,c}+2\,c^2\,\sqrt {b^2-4\,a\,c}\right )}{b^2\,\left (2\,a^2+12\,a\,c-2\,b^2+2\,c^2\right )-4\,a\,c\,\left (2\,a^2+4\,a\,c+2\,c^2\right )} \]

input
int(1/(cos(x)*(a + c*sin(x)^2 + b*sin(x))),x)
 
output
log(sin(x) + 1)/(2*(a - b + c)) - log(sin(x) - 1)/(2*(a + b + c)) + (log(4 
*c^3*sin(x) + b*c^2 + ((a*(4*b*c - 2*c*(b^2 - 4*a*c)^(1/2)) - b^3 + b^2*(b 
^2 - 4*a*c)^(1/2) - 2*c^2*(b^2 - 4*a*c)^(1/2))*(8*a*c^3 + sin(x)*(12*b*c^3 
 - 3*b^3*c + 12*a*b*c^2) + 4*c^4 + 4*a^2*c^2 + 3*b^2*c^2 - ((a*(4*b*c - 2* 
c*(b^2 - 4*a*c)^(1/2)) - b^3 + b^2*(b^2 - 4*a*c)^(1/2) - 2*c^2*(b^2 - 4*a* 
c)^(1/2))*(sin(x)*(8*a*c^4 + 6*b^4*c + 8*c^5 - 8*a^2*c^3 - 8*a^3*c^2 - 6*b 
^2*c^3 - 20*a*b^2*c^2 + 2*a^2*b^2*c) + 4*b*c^4 + 4*b^3*c^2 - 28*a^2*b*c^2 
- 24*a*b*c^3 + 8*a*b^3*c))/(b^2*(12*a*c + 2*a^2 - 2*b^2 + 2*c^2) - 4*a*c*( 
4*a*c + 2*a^2 + 2*c^2)) - a*b^2*c))/(b^2*(12*a*c + 2*a^2 - 2*b^2 + 2*c^2) 
- 4*a*c*(4*a*c + 2*a^2 + 2*c^2)))*(a*(4*b*c - 2*c*(b^2 - 4*a*c)^(1/2)) - b 
^3 + b^2*(b^2 - 4*a*c)^(1/2) - 2*c^2*(b^2 - 4*a*c)^(1/2)))/(b^2*(12*a*c + 
2*a^2 - 2*b^2 + 2*c^2) - 4*a*c*(4*a*c + 2*a^2 + 2*c^2)) + (log(4*c^3*sin(x 
) + b*c^2 + ((a*(4*b*c + 2*c*(b^2 - 4*a*c)^(1/2)) - b^3 - b^2*(b^2 - 4*a*c 
)^(1/2) + 2*c^2*(b^2 - 4*a*c)^(1/2))*(8*a*c^3 + sin(x)*(12*b*c^3 - 3*b^3*c 
 + 12*a*b*c^2) + 4*c^4 + 4*a^2*c^2 + 3*b^2*c^2 - ((a*(4*b*c + 2*c*(b^2 - 4 
*a*c)^(1/2)) - b^3 - b^2*(b^2 - 4*a*c)^(1/2) + 2*c^2*(b^2 - 4*a*c)^(1/2))* 
(sin(x)*(8*a*c^4 + 6*b^4*c + 8*c^5 - 8*a^2*c^3 - 8*a^3*c^2 - 6*b^2*c^3 - 2 
0*a*b^2*c^2 + 2*a^2*b^2*c) + 4*b*c^4 + 4*b^3*c^2 - 28*a^2*b*c^2 - 24*a*b*c 
^3 + 8*a*b^3*c))/(b^2*(12*a*c + 2*a^2 - 2*b^2 + 2*c^2) - 4*a*c*(4*a*c + 2* 
a^2 + 2*c^2)) - a*b^2*c))/(b^2*(12*a*c + 2*a^2 - 2*b^2 + 2*c^2) - 4*a*c...